package com.ipan.weixin.msg.send;

import com.ipan.weixin.msg.general.XmlMsg;

/**
 * 发送文本消息
 * 
 * @author iPan
 * @version 2013-12-25
 */
public class TextSendMsg extends AbstractSendJsonMsg {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 4836929464862794216L;

	private Text text;
	
	public TextSendMsg() {
		super(XmlMsg.TYPE_TEXT);
	}
	
	public TextSendMsg(String touser) {
		super(touser, XmlMsg.TYPE_TEXT);
	}
	
	public TextSendMsg(String touser, String text) {
		super(touser, XmlMsg.TYPE_TEXT);
		setText(text);
	}

	class Text {
		private String content;

		public Text() {
		}

		public Text(String content) {
			this.content = content;
		}

		public String getContent() {
			return content;
		}

		public void setContent(String content) {
			this.content = content;
		}
	}

	public Text getText() {
		return text;
	}

	public void setText(Text text) {
		this.text = text;
	}
	
	public void setText(String text) {
		this.text = new Text(text);
	}
	
	public String textString() {
		return (text != null) ? text.getContent() : null;
	}

//	public static void main(String[] args) {
//		TextServiceMsg msg = new TextServiceMsg("OPENID", "Hello World");
//		System.out.println(msg);
//	}
}

/*
发送：
{
    "touser":"OPENID",
    "msgtype":"text",
    "text":
    {
         "content":"Hello World"
    }
}
*/
